home *** CD-ROM | disk | FTP | other *** search
- /* Copyright © 1994 George R. Cossey */
- /* mmCommonMM_Demo Common and Utilitys
-
- Name: mmCommonMM_Demo.h
- Function: Common for the Marksman™ specific code.
- History: 1/16/94 Original by George Cossey
-
- */
-
- #include "mmTypesMM_Demo.h"
- #include "TypesMM_Demo.h"
-
- /* ======================================================= */
- /* ======================================================= */
-
- extern CApplication *gApplication; /* The application itself */
- extern CMenus *gMenus; /* Menu handler */
- extern CPreferences *gPreferences; /* Preferences handler */
- extern CFiles *gFiles; /* Files handler */
- extern CPrinting *gPrinting; /* Printing handler */
-
- extern UserEventHRec UserEventList; /* User Event record list start */
- extern EventRecord myEvent; /* Event record for all events */
- extern Boolean WNE; /* WaitNextEvent trap is available */
- extern short SleepValue; /* Sleep value for Wait on events */
- extern Boolean doneFlag; /* Exit program flag */
- extern TEHandle theInput; /* Used in text edit selections */
- extern RgnHandle cursorRgn; /* Cursor region for WaitNextEvent */
- extern short ReplyMode; /* Reply mode for AppleEvents */
-
- extern Rect tempRect; /* Temporary rect, not for long term use */
- extern Str255 sTemp; /* Temporary string, not for long term use */
- extern short tempChar; /* Temporary use character */
- extern long LTemp; /* Temporary use long variable */
- extern short DType; /* Temporary use Type of dialog item */
- extern Handle DItem; /* Temporary use Handle to the dialog item */
- extern ControlHandle CItem; /* Temporary use Control handle */
-
- extern WindowLocRec theWindowLocRec;
-
- extern Boolean Doing_MovableModal; /* For Movable Modal dialogs */
- extern Boolean HoldOffUserEvents; /* Flag for holding off UserEvents */
- extern Boolean InTheForeground; /* Flag for running in MultiFinder foreground */
-
- extern HasRec Has; /* Gestalt check results */
-
- extern RGBColor Black_ForeColor,White_BackColor;/* Standard colors */
-
- extern MenuHandle Menu_Apple; /* Menu handle, */
- extern MenuHandle Menu_File; /* Menu handle, File */
- extern MenuHandle Menu_Edit; /* Menu handle, Edit */
- extern MenuHandle Menu_Windows; /* Menu handle, Windows */
-
-
- extern CmmAlert *gCurrentAlert; /* The current Alert object */
- extern CAMy_Alert *gMy_Alert; /* The Alert object */
- extern CmmModalDialog *gCurrentModalDialog; /* The current Modal Dialog object */
- extern CDMy_Modal *gMy_Modal; /* The Modal Dialog object */
- extern CMDMy_Movable_Moda *gMy_Movable_Moda; /* The Modeless Dialog object */
- extern CMDMy_Modeless *gMy_Modeless; /* The Modeless Dialog object */
- extern CMDAbout_Demo *gAbout_Demo; /* The Modeless Dialog object */
- extern CWMy_basic_window *gMy_basic_window; /* The Window object that is active */
- extern CWFloating_window *gFloating_window; /* The Window object that is active */
-
-
- extern "C" {
-
- /* Prototypes */
- pascal Boolean theAlertFilter (DialogPtr theDialog,EventRecord *theEvent,short *itemHit);
- pascal Boolean theModalDialogFilter(DialogPtr theDialog,EventRecord *theEvent,short *itemHit);
-
- /* Copy Pascal strings */
- void PStrCopy(Str255 *SourceString, Str255 *DestString);
-
- /* Concat Pascal strings */
- void PStrCat(Str255 *SourceString, Str255 *DestString);
-
- /* Compare Pascal strings for exact match, case sensitive */
- Boolean PStrCmp(StringPtr Source1String,StringPtr Source2String);
-
- WindowPtr Mk_BehindWindow(short theLayer); /* Get which window to place us behind */
- void Mk_RegisterWindow(WindowPtr theWindowPtr,short theLayer);/* Place layer in RefCon and verify layers */
- void Mk_ClearLayers(void); /* Init our arrays for layered windows */
- void Mk_HiliteWindow(WindowPtr theWindowPtr); /* Hilite our layered window */
- void Mk_DragWindow(WindowPtr theWindowPtr,Point where, Rect bounds);/* Drag our layered window */
- Boolean Mk_Is_FrontWindow(WindowPtr theWindowPtr); /* Get the front window */
- void Mk_CloseLayeredWindow(WindowPtr theWindowPtr);/* Close a layered window */
-
- void Play_The_Sound(short ResID);
-
- void PositionWindow(WindowPtr theWindow,Point WantLocation,Point DefaultPosition);
-
- /* See if a trap is available */
- Boolean CheckTrapAvailable (short trapNumber, short tType);
-
- /* See if any user events are available */
- void GetUserEvent(UserEventPRec TheUserEvent);
-
- /* Add a user event */
- void Add_UserEvent(short ID, short ID2, long Data1, long Data2, Handle theHandle);
-
- /* Set the title for a popup control */
- void SetNameForPopup(ControlHandle theControl);
-
- /* This is a routine used to make a new list */
- void Make_A_List(ListHandle *theList,Rect *theListRect,WindowPtr theWindow,short theStringResourceID,
- short theSize,short theFont,Style theStyle,Boolean InDialog);
-
- /* This is a routine used to add strings to an existing list */
- void Add_List_String(Str255 theString, ListHandle theList, Point *cSize);
-
- /* This is a routine used to get a string from a TE area, limited to 250 characters */
- void Get_TE_String(TEHandle theTEArea, Str255 *theString);
-
- /* This is a routine used to create a TE area */
- void Make_TE_Area(TEHandle *theTEArea, Rect *Position,short theFontSize,short theFont,
- short DefaultStringID);
-
- /* This is a routine used to plot an Sicn, small 16x16 icon */
- void Plot_Sicn(short theSicnID, Rect *Position);
-
- /* This is a routine used to handle a scrollbar */
- void HandleWScrollBar(Point myPt,short code,short Increment,short LIncrement,ControlHandle theControl);
-
- /* Setup a dialog or alert item */
- void SetupTheItem (DialogPtr theDialog,short ItemID,Boolean SizeIt,Boolean ShowIt,
- Boolean EnableIt,Boolean SetTheMax,Rect *thePosition ,long ExtraData ,short StringID );
-
- /* Center a window onto the deepest color screen */
- void CenterOnColorScreen(WindowPtr theWindow);
-
- /* Get the deepest color screen rect */
- void GetDeepestColorScreenRect(Rect *DeepRect);
-
- /* Alert and Dialog support routines */
- void HiliteDefaultButton(DialogPtr theDialog,short theItem);
- void CheckKeysInDialog(DialogPtr theDialog,Boolean *valMyFilter,EventRecord *theEvent,short *itemHit);
- void SetupNormalControl(DialogPtr theDialog,short theItem,Boolean Enabled,short InitialValue);
- void SetupHotSpot(DialogPtr theDialog,short theItem,Boolean MakeHotSpot,long LineWidth,
- long ShadowWidth,short MessageResID,Boolean Enabled);
- void SetupPlugin(DialogPtr theDialog,short theItem,Boolean Enabled,
- long NormalID,long HilitedID,short MessageResID);
- void SetupMinMaxValue(DialogPtr theDialog,short theItem,short min,short max,short value);
- void SetupPopupMenu(DialogPtr theDialog,short theItem,Boolean Enabled,short theMenuID,short value);
- void SetupPalette(DialogPtr theDialog,short theItem,Boolean Enabled,long NumberRows,long NumberCols,
- long PalPictureID,long HiliteMethod);
- void SetupIconSicn(DialogPtr theDialog,short theItem,Boolean Enabled,
- long NormalID,long HilitedID);
- void ClearTheRadio(DialogPtr theDialog,short theItem,short *value);
-
- /* Window support routines */
- void DrawStaticTextBox(short ResID,Rect *theRect,short Justify,short theSize,short theFont,Style theStyle);
- void DrawStaticLine(short ResID,short Left,short Top,short theSize,short theFont,Style theStyle);
- void DrawTheTEArea(Rect *theTERect,TEHandle theTE,short theSize,short theFont,Style theStyle);
- ControlHandle MakeNormalControl(WindowPtr theWindow,short theResID,Boolean Enabled,short InitialValue);
- ControlHandle MakeHotSpot(WindowPtr theWindow,short theResID,Boolean MakeHotSpot,long LineWidth,
- long ShadowWidth,short MessageResID,Boolean Enabled);
- ControlHandle MakeIconSicn(WindowPtr theWindow,short theResID,Boolean Enabled,
- long NormalID,long HilitedID);
- ControlHandle MakePlugin(WindowPtr theWindow,short theResID,Boolean Enabled,
- long NormalID,long HilitedID,short MessageResID,short InitialValue);
- void MakeMinMaxValue(ControlHandle theControl,short min,short max,short value);
- ControlHandle MakePopupMenu(WindowPtr theWindow,short theResID,Boolean Enabled,short theMenuID,short value);
- ControlHandle MakePalette(WindowPtr theWindow,short theResID,Boolean Enabled,long NumberRows,long NumberCols,
- long PalPictureID,long HiliteMethod);
-
- void UpdateTheList(RgnHandle theRgn,ListHandle theList,Rect *theRect,short theSize,short theFont,Style theStyle,Boolean InDialog);
- void ClickInTheList(Point myPt,short modifiers,ListHandle theList,short theSize,short theFont,Style theStyle,Boolean InDialog);
- void Activate_TE_Area(Boolean InDialog,Point myPt,TEHandle theTE,short textSize,short textFont,Style textStyle);
- }
-
- /* ======================================================= */
- /* ======================================================= */
-
-